#include "Health.h"


Health::Health()
	:mPosition(0.0f, 0.0f),
	mScale(1.5f, 1.0f),
	mMaxHealth(100),
	mCurrentHealth(100),
	mHit(false),
	mFacingLeft(false)
{
	mSprite.SetScale(mScale,true);
};

Health::~Health()
{
}


void Health::Load()
{
	mSprite.Load("button_off.png");
}

void Health::Unload()
{
	mSprite.Unload();
}

void Health::Update(float deltaTime)
{
	mSprite.Update(deltaTime);

}

void Health::Render(const SVector2& viewOffset)
{
	if(mHit)
	{
		float ratio = (float)mCurrentHealth/(float)mMaxHealth;
		int originalWidth=mSprite.GetWidth();

		mScale.x *=ratio;
		mSprite.SetScale(SVector2(mScale.x,1),0);


		mHit=false;
	}
	mSprite.SetPosition(mPosition);
	mSprite.Render();


}

